﻿@model IEnumerable<INTREPWEB.Models.Item>

@{
    ViewBag.Title = "Index";
    if (IsAjax)
    {
        Layout = null;
    }
}
<center>
<table>
    <tr>
        <th>
            RE
        </th>
        <th>
            Exportador
        </th>
        <th>
            PesoManifestado
        </th>
        <th>
            PesoEmbarcado
        </th>
        <th>
            Unidade
        </th>
        <th></th>
    </tr>

@foreach (var item in Model) {
    var re = item.RE != null ? item.RE : "-";
    var unidade = item.Unidade != null ? item.Unidade : "T";
    <tr>
        <td>
            @Ajax.ActionLink(re, "Editar", new { id = item.Id }, new AjaxOptions { UpdateTargetId = "modal1", OnSuccess = "$.modalPopup('modal1')" })
        </td>
        <td>
            @Ajax.ActionLink(item.Exportador.Nome, "Editar", new { id = item.Id }, new AjaxOptions { UpdateTargetId = "modal1", OnSuccess = "$.modalPopup('modal1')" })
        </td>
        <td>
            @Ajax.ActionLink(item.PesoManifestado.ToString(), "Editar", new { id = item.Id }, new AjaxOptions { UpdateTargetId = "modal1", OnSuccess = "$.modalPopup('modal1')" })
        </td>
        <td>
            @Ajax.ActionLink(item.PesoEmbarcado.ToString(), "Editar", new { id = item.Id }, new AjaxOptions { UpdateTargetId = "modal1", OnSuccess = "$.modalPopup('modal1')" })
        </td>
        <td>
            @Ajax.ActionLink(unidade, "Editar", new { id = item.Id }, new AjaxOptions { UpdateTargetId = "modal1", OnSuccess = "$.modalPopup('modal1')" })
        </td>
        <td>
            @Ajax.ActionLink("x", "Deletar", new { id = item.Id }, new AjaxOptions { UpdateTargetId = "modal1", OnSuccess = "$.modalPopup('modal1')" })
        </td>
    </tr>
}

</table>
</center>